import {reqCategoryList} from '@/api'

const state = {
	// 商品分类的数据
	categroyList: []
}

const mutations = {
	GOCATEGORY(state,categroy){
		// 修改state
		state.categroyList = categroy;
	}
}

const actions = {
	//获取商品分类数据
	async goCategory({commit}){
		let result = await reqCategoryList();
		if(result.code == 200){
			// 提交mutations
			commit('GOCATEGORY', result.data)
		}
	}
}

const getters = {}

export default ({
	state,
	mutations,
	actions,
	getters
})